home *** CD-ROM | disk | FTP | other *** search
- Path: news.production.compuserve.com!news
- From: Dave Hand <70621.3624@CompuServe.COM>
- Newsgroups: comp.lang.c++
- Subject: Re: Poor floating point code in BC++
- Date: 4 Jan 1996 22:37:04 GMT
- Organization: Singular Software, Inc.
- Message-ID: <4chkqg$bve$1@mhadf.production.compuserve.com>
- References: <DKnMHr.IqA@uns.bris.ac.uk>
-
- > Not necessarily, as I pointed out in a previous post, a fistp
- > is insufficent if the rounding mode is unknown, or known not
- > to be round to zero. Conversion of a float to an int must
- > produce the value closer to zero (because the standard says
- > so). Such a restriction is not required for other floating
- > point arithmetic, because the C standard does not say anything
- > about rounding.
-
- > Many C systems permit the rounding mode to be set by a call,
- > it appears that borland C is one such system.
-
- You are correct that you need to set the RC flag in the NPX
- control word, but my point was that there is no need for a
- function call. Also, the rounding mode only needs to be set
- once. By using in-line assembly, I found that the cast could be
- done about 4 times faster and was just wondering if any other
- compilers did a better job of generating floating point code.
-
- The default RC flag for BC is 00 (ie round to nearest integer),
- and I have not found a way to change this outside assembly code.
- You indicated that there is a way to do this?
-
- Thanks for the input.
-
-